 package fr.vvins.core.order.entity;



import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import fr.vvins.core.dao.EntityImpl;
import fr.vvins.core.user.entity.User;

/**
 * Order entity
 */
@Entity
@Table(schema="vvins", name="VV_ORDER")
public class Order extends EntityImpl implements Serializable {

	private static final long serialVersionUID = -2055409151138564621L;
	@Id
	@GeneratedValue
	@Column(name="ID")
	private Integer id;
	@ManyToOne
	@JoinColumn(name="USER_ID")
	private User user;
	@Basic
	@Column(name="CREATION_DATE")
	private Date creationDate;
	@Basic
	@Column(name="STATUS")
	private Integer status;
	@Basic
	@Column(name="INITIAL_AMOUNT")
	private String initialAmount;
	@Basic
	@Column(name="AMOUNT")
	private String amount;
	@Basic
	@Column(name="TAX_AMOUNT")
	private String taxAmount;
	@OneToMany(mappedBy="order")
	private Set<PaymentItem> paymentItems = new HashSet<PaymentItem>(0);
	@OneToMany(mappedBy="order")
	private Set<CommerceItem> commerceItems = new HashSet<CommerceItem>(0);
	@OneToMany(mappedBy="order")
	private Set<ShippingItem> shippingItems = new HashSet<ShippingItem>(0);

	public Order() {
	}

	public Order(Integer id, User user, Date creationDate, Integer status,
			String initialAmount, String amount, String taxAmount,
			Set<PaymentItem> paymentItems, Set<CommerceItem> commerceItems,
			Set<ShippingItem> shippingItems) {
		super();
		this.id = id;
		this.user = user;
		this.creationDate = creationDate;
		this.status = status;
		this.initialAmount = initialAmount;
		this.amount = amount;
		this.taxAmount = taxAmount;
		this.paymentItems = paymentItems;
		this.commerceItems = commerceItems;
		this.shippingItems = shippingItems;
	}

	public Order(Integer id) {
		this.id = id;
	}

	@Override
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getInitialAmount() {
		return initialAmount;
	}

	public void setInitialAmount(String initialAmount) {
		this.initialAmount = initialAmount;
	}

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public String getTaxAmount() {
		return taxAmount;
	}

	public void setTaxAmount(String taxAmount) {
		this.taxAmount = taxAmount;
	}

	public Set<PaymentItem> getPaymentItems() {
		return paymentItems;
	}

	public void setPaymentItems(Set<PaymentItem> paymentItems) {
		this.paymentItems = paymentItems;
	}

	public Set<CommerceItem> getCommerceItems() {
		return commerceItems;
	}

	public void setCommerceItems(Set<CommerceItem> commerceItems) {
		this.commerceItems = commerceItems;
	}

	public Set<ShippingItem> getShippingItems() {
		return shippingItems;
	}

	public void setShippingItems(Set<ShippingItem> shippingItems) {
		this.shippingItems = shippingItems;
	}


}
